package com.example.service.ribbon.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;

@Service
public class TestService {
	@Autowired
	RestTemplate restTemplate;

	@HystrixCommand(fallbackMethod = "indexError")
	public String testService(String name) {
		return restTemplate.getForObject("http://APP/index?name=" + name, String.class);
	}

	public String indexError(String name)
	{
		return "hi,"+name+",sorry,error!";
	}
}
